const obj = {
  '0.and.c_log_module': {
    op: 'eq',
    value: 8,
    name: '字段名称',
    desc: '',
    types: ['str', 'num']
  },
  '0.and.e_application_app_protocol': {
    op: 'ranges',
    value: {
      lt: 6,
      lte: 6,
      gt: 1,
      gte: 1
    },
    name: '字段名称',
    desc: '字段描述',
    types: ['str', 'num']
  },
  '0.and.or.field1': {
    op: 'eq',
    value: 5,
    name: '字段名称',
    desc: '字段描述',
    types: ['str', 'num']
  },
  '0.and.or.field2': {
    op: 'in',
    value: 6,
    name: '字段名称',
    desc: '字段描述',
    types: ['str', 'num']
  },
  '0.and.and.field3': {
    op: 'neq',
    value: 5,
    name: '字段名称',
    desc: '字段描述',
    types: ['str', 'num']
  },
  '0.and.and.or.field3_1': {
    op: 'neq',
    value: 5,
    name: '字段名称',
    desc: '字段描述',
    types: ['str', 'num']
  },
  '0.and.and.or.field3_2': {
    op: 'neq',
    value: 8,
    name: '字段名称',
    desc: '字段描述',
    types: ['str', 'num']
  }
}

let result = {}
for (let key in obj) {
  let arr = key.split('.')
  const tmp = recusion(arr.slice(1), 0, obj[key])
  recusion2(result, tmp)
}
console.log(result)

// 将and.c_log_module ==> { and: { c_log_module: {} } }
function recusion(arr, n, value) {
  return {
    [arr[n]]: (n < arr.length - 1) ? recusion(arr, n + 1, value) : {
      [value.op]: value.value,
      "_": value.name + ',' + value.desc + ',' + value.types.join(',')
    }
  }
}

// 合并结果数据和临时数据对象
function recusion2(result, target) {
  for (let key in target) {
    if (result[key]) { // result.and
      if (['and', 'or'].includes(key)) {
        recusion2(result[key], target[key])
      } else {
        result[key] = {
          ...result[key],
          ...target[key]
        }
      }
    } else {
      result[key] = target[key]
    }
  }
}